<?php
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Multi */ ?>
<?php $_option = $block->getOption() ?>
<?php $_selections = $_option->getSelections() ?>
<div class="field option <?php echo ($_option->getRequired()) ? ' required': ''; ?>">
    <label class="label" for="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?>">
        <span><?php echo $block->escapeHtml($_option->getTitle()) ?></span>
    </label>
    <div class="control">
        <?php if ($block->showSingle()): ?>
            <?php /* @escapeNotVerified */ echo $block->getSelectionQtyTitlePrice($_selections[0]) ?>
            <input type="hidden"
                   name="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>]"
                   value="<?php /* @escapeNotVerified */ echo $_selections[0]->getSelectionId() ?>"/>
        <?php else: ?>
            <select multiple="multiple"
                    size="5"
                    id="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?>"
                    name="bundle_option[<?php /* @escapeNotVerified */ echo $_option->getId() ?>][]"
                    class="bundle-option-<?php /* @escapeNotVerified */ echo $_option->getId() ?> multiselect product bundle option change-container-classname"
                    <?php if ($_option->getRequired()) echo 'data-validate={required:true}' ?>>
                <?php if(!$_option->getRequired()): ?>
                    <option value=""><?php /* @escapeNotVerified */ echo __('None') ?></option>
                <?php endif; ?>
                <?php foreach ($_selections as $_selection): ?>
                    <option value="<?php /* @escapeNotVerified */ echo $_selection->getSelectionId() ?>"
                            <?php if ($block->isSelected($_selection)) echo ' selected="selected"' ?>
                            <?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>>
                        <?php /* @escapeNotVerified */ echo $block->getSelectionQtyTitlePrice($_selection, false) ?>
                    </option>
                <?php endforeach; ?>
            </select>
        <?php endif; ?>
    </div>
</div>
